package com.dzjcloud.dzj.common.minio.utils;

import com.dzjcloud.dzj.common.minio.enums.BucketEnum;
import lombok.experimental.UtilityClass;

import java.util.Objects;

/**
 * <h3>pig</h3>
 * <p>bucket工具类</p>
 *
 * @author : DongZeJian
 * @date : 2020-12-31 15:51
 **/
@UtilityClass
public class BucketUtils {

	/**
	 * 根据bucketCode获取bucket名称
	 *
	 * @param bucketCode : bucketCode定义值
	 * @return 返回对应bucketCode对应的bucket名称
	 */
	public static String getValue(Integer bucketCode) {
		if (Objects.isNull(bucketCode)) {
			return null;
		}
		for (BucketEnum bucketEnum : BucketEnum.values()) {
			if (bucketEnum.getBucketCode().equals(bucketCode)) {
				return bucketEnum.getBucketName();
			}
		}
		return null;
	}
}
